/*
Created		26/08/2009
Modified		29/03/2011
Project		CIMa Planning
Model			Main
Company		CPIngredientes
Author		RGM
Version		0.1
Database		MS SQL 2000 
*/

Create table [plants_initials_costs]
(
	[plant_initial_cost_id] Integer Identity NOT NULL,
	[plant_id] Integer NOT NULL,
	[version_id] Integer NOT NULL,
	[corn_type_id] Integer NOT NULL,
	[cost_element_id] Integer NOT NULL,
	[amount] Decimal(18,4) NOT NULL,
Primary Key ([plant_initial_cost_id])
) 
go

Alter table [plants_initials_costs] add  foreign key([cost_element_id]) references [costs_elements] ([cost_element_id])  on update cascade on delete no action 
go
Alter table [plants_initials_costs] add  foreign key([version_id]) references [versions] ([version_id])  on update cascade on delete cascade 
go
Alter table [plants_initials_costs] add  foreign key([plant_id]) references [plants] ([plant_id])  on update cascade on delete no action 
go
Alter table [plants_initials_costs] add  foreign key([corn_type_id]) references [corns_types] ([corn_type_id])  on update cascade on delete no action 
go


Set quoted_identifier on
go



Set quoted_identifier off
go


